﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 作业2
{
    class Program
    {
        static int fun(ref int Front, ref int End)//给出连续两项，求后项，并把求到的后项作为给出项的后项返回
        {
            int temp;
            temp = End;
            End += Front;
            Front = temp;
            return 0;          
        }
        static void Main(string[] args)
        {
            int n;
            int front = 1, end = 1;
            Console.WriteLine("输入第几项：");
            string s = Console.ReadLine();
            n = int.Parse(s);//类型转换
            int m;
            m = n;
            while (m > 2)
            {
                fun(ref front,ref  end);
                m--;
            }
            Console.WriteLine("第{0}项为：{1}",n,end);
            Console.ReadKey();
        }
    }
}
